package chixing.day17.factory;

/**
 * 简单工厂模式
 * 优势：
 *      面向接口编程，降低业务的耦合性，内部业务实现不暴露在外部
 * 弊端：
 *      若要添加新的子类，工厂业务代码也要修改，可维护性不好
 */
public class CarFactory {

    public static Car getCar(String name) {
        Car car = null;
        switch (name) {
            case "Tesla":
                car = new TeslaCar();
            case "Xiaomi":
                car = new TeslaCar();
            case "Toyota":
                car = new TeslaCar();
        }
        return car;
    }

}
